CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

# compiler configuration
IF(CMAKE_VERSION VERSION_LESS "3.1")
    IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
    ENDIF()
ELSE()
    SET(CMAKE_CXX_STANDARD 11)
ENDIF()

INCLUDE_DIRECTORIES(
    ./
    ${SPDLOG_INCLUDE_DIR}
    ${COMMON_INCLUDE_DIR}
)

LINK_DIRECTORIES(
    ${SPDLOG_LIBRARY_DIR}
    ${COMMON_LIBRARY_DIR}
)

# submodule
ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY(logger)

# main app
SET(SRC_LIST ./main/main.cpp)
MESSAGE(STATUS "This is BINARY dir " ${PROJECT_BINARY_DIR})
MESSAGE(STATUS "This is SOURCE dir " ${PROJECT_SOURCE_DIR})
ADD_EXECUTABLE(HelloApp ${SRC_LIST})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
TARGET_LINK_LIBRARIES(HelloApp module_logger)

INSTALL(TARGETS HelloApp
    ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin)


